/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.templet.entity;

import com.thinkgem.jeesite.common.persistence.DataEntity;
import com.thinkgem.jeesite.modules.equipment.entity.EleEquipmentType;
import com.thinkgem.jeesite.modules.source.entity.background.EleSourceBackground;
import com.thinkgem.jeesite.modules.source.entity.font.EleSourceFont;
import com.thinkgem.jeesite.modules.sys.entity.User;

import org.hibernate.validator.constraints.Length;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import java.util.List;

/**
 * 模板管理Entity
 * @author ZC
 * @version 2017-04-27
 */
@XmlRootElement(name = "displaycfg")
public class EleTemplet extends DataEntity<EleTemplet> {
	
	private static final long serialVersionUID = 1L;
	private String name;		// 模板名称
	private EleEquipmentType type;		// 设备类型
	private int width;		// 宽度
	private int height;		// 高度
    private EleSourceFont font;
	private String displaymode;
	private String fullscreen;
	private String resolution;
	private List<EleTempletSource> eleTempletSourceList;		// 子表列表
	private String flag; 	// 0：保存方案； 1：保存方案并生成代码
	private String url; 	// 0：保存方案； 1：保存方案并生成代码
	private EleSourceBackground background;
	public List<User> users = null;

    public static final double LAND_WIDTH = 750;
    public static final double LAND_HEIGHT = 500;
    public static final double PORT_HEIGHT = 1100;

    public double getLandWidth(){
        return LAND_WIDTH;
    }

    public double getLandHeight(){
        return LAND_HEIGHT;
    }

    public double getPortHeight(){
        return PORT_HEIGHT;
    }


	public EleTemplet() {
		super();
	}

	public EleTemplet(String id){
		super(id);
	}
	
	@XmlTransient
	public List<User> getUsers() {
		return users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

	@XmlTransient
	@Length(min=0, max=255, message="模板名称长度必须介于 0 和 255 之间")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	@XmlTransient
	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}
	@XmlTransient
	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}
	@XmlElement(name="resolution")
	public String getResolution(){
		return width+"x"+height;
	}
	public void setResolution(String resolution) {
		this.resolution = resolution;
	}
	
	@XmlTransient
	public String getResolutionStr(){
		return resolution;
	}
	
	
	@XmlElement(name="displaynode")
	public List<EleTempletSource> getEleTempletSourceList() {
		return eleTempletSourceList;
	}

	public void setEleTempletSourceList(List<EleTempletSource> eleTempletSourceList) {
		this.eleTempletSourceList = eleTempletSourceList;
	}

	public String getFlag(){
		return flag;
	}

	public void setFlag(String flag){
		this.flag = flag;
	}

    @XmlTransient
	public EleEquipmentType getType(){
		return type;
	}

	public void setType(EleEquipmentType type){
		this.type = type;
	}

	@XmlElement(name = "font", required = true)
	public String getFontName(){
		if(null == font){
			return "";
		}
		return font.getName();
	}

	@XmlTransient
    public EleSourceFont getFont(){
        return font;
    }

    public void setFont(EleSourceFont font){
        this.font = font;
    }

	
	@XmlElement(name="displaymode")
    public String getDisplaymode(){
		return displaymode;
    }
	public void setDisplaymode(String displaymode){
		this.displaymode = displaymode;
	}
	
	
	//@XmlElement(name="fullscreen")
	@XmlTransient
	public String getFullscreen() {
		return fullscreen;
	}

	public void setFullscreen(String fullscreen) {
		this.fullscreen = fullscreen;
	}

	@XmlTransient
	public String getUrl(){
		return url;
	}

	public void setUrl(String url){
		this.url = url;
	}
	
	@XmlTransient
	public EleSourceBackground getBackground() {
		return background;
	}

	public void setBackground(EleSourceBackground background) {
		this.background = background;
	}
	
}